<?php
 class mnumeroorden extends Model{
 	 private $mTableName = "GW_NumeroOrden";
 	 
 	 function __construct(){
 	 	       parent::Model();
 	 	       $this->load->database();
 	 }
 	 
 	 public function loadOrden($id){
 	 	   $this->db->where('id',2);
 	 	   

 	 	   $ojetos = $this->db->get_where($this->mTableName);
 	 	   
 	 	   return $this->arrayQueryDataTable($ojetos);
 	 }
 	 
 	public function arrayQueryDataTable($array){
 	 	if ($array->num_rows == 0) {
 	 		return false;
 	 	}
 	 	
 	 	$orden_array = array();
 	 	
 	 	foreach ($array->result() as $k){
 	 		$orden_array[] = new numeroordem($k);
 	 	}
 	 	
 	 	return $orden_array;
 	 	
 	 	
 	 }
 	 
 	  function LoadCompaniaById($id_compania) 
	  {
		  $qresult = $this->db->get_where($this->mTableName,array('id' => $id_compania));		
		  if ($qresult->num_rows() == 0)
		  {
			 return false;
		  }	

			return new numeroordem($qresult->row());
	 }
		
 	 
 
 	 
 }

class numeroordem{
  	    
  	    private $idOrden = 0;
  	    private $descricion = "";
  	  
  	    
  	    function __construct($ojt){
  	    	    
  	    	      $this->setId($ojt->id);
  	    	      $this->setDescriccion($ojt->descricion);
  	    
  	    	
  	    }
  	    
  	    
  	    //id de la orden
  	    public function setId($id){
  	    	$this->idOrden = $id;
  	    }
  	    
  	    public function getId(){
  	    	return $this->idOrden;
  	    }
  	    
  	    //descriccion de la orden
  	    public function setDescriccion($oj){
  	    	$this->descricion = $oj;
  	    }
  	    
  	    public function getDescriccion(){
  	    	return $this->descricion;
  	    }
  	    
  	   
  	
  }

?>